$(document).ready(function(){
	$('#formadd, #formedit').submit(function(){
		var thisform = $(this);
		var quantity = thisform.find('input[name="quantity"]').first().val();
		var startDate = thisform.find('input[name="startDate"]').first().val();
		var endDate = thisform.find('input[name="endDate"]').first().val();
		if (quantity <= 0) {
			alert('Quantity ordered must be a positive number.');
			return false;
		}
		if (endDate < startDate) {
			alert('Recurring End Date must not be before Start Date.');
			return false;
		}
	});
});